<!DOCTYPE html>
<html lang="zh-CN" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->
    <meta name="description" content="">
    <meta name="author" content="">
    <title>Logistic通运网</title>
    <!-- Bootstrap core CSS -->
    <link href="../bootstrap-3.3.7-dist/css/bootstrap.min.css" rel="stylesheet">
    <script src="https://cdn.bootcss.com/html5shiv/3.7.3/html5shiv.min.js"></script>
    <script src="https://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>

<body>
<nav th:replace="~{front/log/log_topbar::top}"></nav>
<div class="container" style="margin-top: 80px">
    <div>
        <div>
            <span style="width: 3px;height: 20px;background: #fa5000;display: block;float: left;margin: 15px 0 0 0;"></span>&nbsp;&nbsp;
            <span style="font-size:20px;font-weight: bold;color: #fa5000; font-family: 'Hiragino Sans GB', 'Microsoft Yahei UI', 'Microsoft Yahei', 微软雅黑, 'Segoe UI', Tahoma, 宋体b8b体, SimSun, sans-serif;display:inline-block;margin-top: 11px;">找物流专线</span>
            <!---------------------------------- 选择出发地和到达地 ----------------------------------->
            <div style="display: inline-block; margin-bottom: 0;margin-left: 20px">
                <form method="post" action="/route_list_search">
                    <div class="row form-group" style="display: inline-block; margin-bottom: 0;margin-left: 20px">
                        <select style="width: 100px; height: 34px; border-radius: 4px; border: 1px solid #b6bec5" name="rProvince" id="province1">
                            <option >出发省</option>
                        </select>
                        <select style="width: 100px; height: 34px; border-radius: 4px; border: 1px solid #b6bec5" name="rCity" id="city1">
                            <option >出发市</option>
                        </select>
                        <select style="width: 100px; height: 34px; border-radius: 4px; border: 1px solid #b6bec5" name="rCountry" id="country1">
                            <option >出发区</option>
                        </select>
                    </div>
                    <div style="display: inline-block; margin-left: 40px"><img src="../images/arrowGray.png"></div>
                    <div class="row form-group" style="display: inline-block; margin-bottom: 0;margin-left: 20px">
                        <select style="width: 100px; height: 34px; border-radius: 4px; border: 1px solid #b6bec5" name="dProvince" id="province2">
                            <option >到达省</option>
                        </select>
                        <select style="width: 100px; height: 34px; border-radius: 4px; border: 1px solid #b6bec5" name="dCity" id="city2">
                            <option >到达市</option>
                        </select>
                        <select style="width: 100px; height: 34px; border-radius: 4px; border: 1px solid #b6bec5" name="dCountry" id="country2">
                            <option >到达区</option>
                        </select>
                    </div>
                    <div style="display:inline-block;margin-left:20px;"><button id="search1" style="background:#fa5000;height:34px" type="submit" class="btn btn-warning btn-sm">查找</button></div>
                </form>
            </div>
            <!-- ------------------------------------------------------------------------------------------------------------------------------------------------------------ -->
            <div style="margin-top: 5px;margin-bottom: 25px; background-color: #fa5000;width: 1140px;height: 1px;"></div>
        </div>
        <div>
            <table class="table table-hover">
                <thead>
                    <tr>
                        <th>出发地 → 到达地 </th>
                        <th>公司名称 </th>
                        <th>轻货价格 </th>
                        <th>重货价格 </th>
                        <th><span style="margin-left: 8px;">查看</span></th>
                        <th><span style="margin-left: 8px;">发货</span></th>
                    </tr>
                </thead>
                <tbody>
                    <tr th:each="route:${routes}">
                        <th style="width: 341px"><a style="text-decoration: none" th:href="@{'/logisticsPlatform/route_detail_front?routeId='+${route.routeId}}" th:text="${route.routeResourceProvince}+${route.routeResourceCity}+${route.routeResourceCountry}+' → '+${route.routeDestinationProvince}+${route.routeDestinationCity}+${route.routeDestinationCountry}" target="_blank"></a></th>
                        <th style="width: 224px"><a style="text-decoration: none" th:text="${route.routeCompany}" th:href="@{'com_detail_material?companyName='+${route.routeCompany}}" target="_blank"></a></th>
                        <th style="width: 149px;color: #fa5000;" th:text="${route.routePriceLight}"></th>
                        <th th:text="${route.routePriceHeavy}"></th>
                        <th><div><a target="_blank" th:href="@{'/logisticsPlatform/route_detail_front?routeId='+${route.routeId}}"><button type="submit" class="btn btn-default btn-sm">查看</button></a></div></th>
                        <th><div><a target="_blank" th:href="@{'/order_send_before?routeId='+${route.routeId}}"><button style="color: #fa5000" type="submit" class="btn btn-default btn-sm">发货</button></a></div></th>
                    </tr>
                </tbody>
            </table>
            <div style="margin-top: 0"><hr style="background-color: rgb(221,221,221); height: 1px; margin-top: 0"></div>
        </div>
    </div>
    <div>
        <div>
            <span style="width: 3px;height: 20px;background: #fa5000;display: block;float: left;margin: 15px 0 0 0;"></span>&nbsp;&nbsp;
            <span style="font-size:20px;font-weight: bold;color: #fa5000; font-family: 'Hiragino Sans GB', 'Microsoft Yahei UI', 'Microsoft Yahei', 微软雅黑, 'Segoe UI', Tahoma, 宋体b8b体, SimSun, sans-serif;display:inline-block;margin-top: 11px;">找货源</span>
            <!---------------------------------- 选择出发地和到达地 ----------------------------------->
            <div style="display: inline-block; margin-bottom: 0;margin-left: 60px">
                <form method="post" action="/material_list_search">
                    <div class="row form-group" style="display: inline-block; margin-bottom: 0;margin-left: 20px">
                        <select style="width: 100px; height: 34px; border-radius: 4px; border: 1px solid #b6bec5" name="rProvince" id="province3">
                            <option >出发省</option>
                        </select>
                        <select style="width: 100px; height: 34px; border-radius: 4px; border: 1px solid #b6bec5" name="rCity" id="city3">
                            <option >出发市</option>
                        </select>
                        <select style="width: 100px; height: 34px; border-radius: 4px; border: 1px solid #b6bec5" name="rCountry" id="country3">
                            <option >出发区</option>
                        </select>
                    </div>
                    <div style="display: inline-block; margin-left: 40px"><img src="../images/arrowGray.png"></div>
                    <div class="row form-group" style="display: inline-block; margin-bottom: 0;margin-left: 20px">
                        <select style="width: 100px; height: 34px; border-radius: 4px; border: 1px solid #b6bec5" name="dProvince" id="province4">
                            <option >到达省</option>
                        </select>
                        <select style="width: 100px; height: 34px; border-radius: 4px; border: 1px solid #b6bec5" name="dCity" id="city4">
                            <option >到达市</option>
                        </select>
                        <select style="width: 100px; height: 34px; border-radius: 4px; border: 1px solid #b6bec5" name="dCountry" id="country4">
                            <option >到达区</option>
                        </select>
                    </div>
                    <div style="display:inline-block;margin-left:20px;"><button id="search2" style="background:#fa5000;height:34px" type="submit" class="btn btn-warning btn-sm">查找</button></div>
                </form>
            </div>
            <!-- ------------------------------------------------------------------------------------------------------------------------------------------------------------ -->
            <div style="margin-top: 5px;margin-bottom: 25px; background-color: #fa5000;width: 1140px;height: 1px;"></div>
        </div>
        <div>
            <table class="table table-hover">
                <thead>
                <tr>
                    <th>出发地 → 到达地 </th>
                    <th>货物类型 </th>
                    <th>货物名称 </th>
                    <th>供应商 </th>
                    <th>重量</th>
                    <th>体积</th>
                    <th>运价</th>
                    <th>发布时间</th>
                </tr>
                </thead>
                <tbody>
                <tr th:each="material:${materials}">
                    <th><a style="text-decoration: none;" th:text="${material.resourceAreaProvince}+${material.resourceAreaCity}+${material.resourceAreaCountry}+' → '+${material.destinationAreaProvince}+${material.destinationAreaCity}+${material.destinationAreaCountry}" th:href="@{'/logisticsPlatform/material_detail_front?materialId='+${material.materialId}}" target="_blank"></a></th>
                    <th th:text="${material.materialType}"></th>
                    <th style="color: #fa5000" th:text="${material.materialName}"></th>
                    <th><a th:text="${material.company}" target="_blank" style="text-decoration: none" th:href="@{'com_detail_material?companyName='+${material.company}}"></a></th>
                    <th style="color: #fa5000" th:text="${material.weight}"></th>
                    <th th:text="${material.capacity}"></th>
                    <th th:text="面议"></th>
                    <th th:text="${material.updateTime}"></th>
                </tr>
                </tbody>
            </table>
            <div style="margin-top: 0"><hr style="background-color: rgb(221,221,221); height: 1px; margin-top: 0"></div>
        </div>
    </div>
    <div>
        <div>
            <span style="width: 3px;height: 20px;background: #fa5000;display: block;float: left;margin: 15px 0 0 0;"></span>&nbsp;&nbsp;
            <span style="font-size:20px;font-weight: bold;color: #fa5000; font-family: 'Hiragino Sans GB', 'Microsoft Yahei UI', 'Microsoft Yahei', 微软雅黑, 'Segoe UI', Tahoma, 宋体b8b体, SimSun, sans-serif;display:inline-block;margin-top: 11px;">找物流公司</span>
            <!---------------------------------- 输入公司关键字 ----------------------------------->
            <div style="display: inline-block; margin-bottom: 0;margin-left: 20px">
                <form method="post" action="/company_list_search">
                    <div class="row form-group" style="display: inline-block; margin-bottom: 0;margin-left: 20px">
                        <label class="sr-only" for="companyName">companyName</label>
                        <input type="text" class="form-control" id="companyName" name="companyName" placeholder="输入公司关键字">
                    </div>
                    <div style="display:inline-block;margin-left:20px;"><button style="background:#fa5000;height:34px" type="submit" class="btn btn-warning btn-sm">查找</button></div>
                </form>
            </div>
            <!-- ------------------------------------------------------------------------------------------------------------------------------------------------------------ -->
            <div style="margin-top: 5px;margin-bottom: 25px; background-color: #fa5000;width: 1140px;height: 1px;"></div>
        </div>
        <div>
            <table class="table table-hover">
                <thead>
                <tr>
                    <th>公司名称 </th>
                    <th>总部所在地 </th>
                    <th>公司法人 </th>
                    <th>联系电话</th>
                    <th>发布时间 </th>
                </tr>
                </thead>
                <tbody>
                <tr th:each="company:${companies}">
                    <th><a style="text-decoration: none" th:text="${company.companyName}" th:href="@{'com_detail_material?companyName='+${company.companyName}}" target="_blank"></a></th>
                    <th th:text="${company.addressProvince}+'-'+${company.addressCity}"></th>
                    <th th:text="${company.corporation}"></th>
                    <th style="color: #fa5000" th:text="${company.phoneNumber}"></th>
                    <th th:text="${company.updateTime}"></th>
                </tr>
                </tbody>
            </table>
            <div style="margin-top: 0"><hr style="background-color: rgb(221,221,221); height: 1px; margin-top: 0"></div>
        </div>
    </div>

    <span style="width: 3px;height: 20px;background: #fa5000;display: block;float: left;margin: 15px 0 0 0;"></span>&nbsp;&nbsp;
    <span style="font-size:20px;font-weight: bold;color: #fa5000; font-family: 'Hiragino Sans GB', 'Microsoft Yahei UI', 'Microsoft Yahei', 微软雅黑, 'Segoe UI', Tahoma, 宋体b8b体, SimSun, sans-serif;display:inline-block;margin-top: 11px;">物流资讯</span>
    <div style="margin-top: 5px;margin-bottom: 25px; background-color: #fa5000;width: 1140px;height: 1px;"></div>
    <div class="row">
        <div class="col-xs-6" th:each="news:${newsS}">
            <p>
                <a th:href="@{'/logisticsPlatform/news_detail_front?newsId='+${news.newsId}}" style="text-decoration: none; text-align: left; font-weight: bold" target="_blank" th:text="${news.newsName}"></a>
                <span style="float: right;" th:text="${news.updateTime}"></span>
            </p>
            <div style="margin-top: 0"><hr style="background-color: rgb(221,221,221); height: 1px; margin-top: 0;"></div>
        </div>
        <div class="col-xs-6" th:each="news:${newsSOther}">
            <p>
                <a th:href="@{'/logisticsPlatform/news_detail_front?newsId='+${news.newsId}}" style="text-decoration: none; text-align: left; font-weight: bold" target="_blank" th:text="${news.newsName}"></a>
                <span style="float: right;" th:text="${news.updateTime}"></span>
            </p>
            <div style="margin-top: 0"><hr style="background-color: rgb(221,221,221); height: 1px; margin-top: 0;"></div>
        </div>
    </div>

</div>

<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="../jquery-3.3.1.js"></script>
<script src="../bootstrap-3.3.7-dist/js/bootstrap.min.js"></script>

<script>
    //出发地1
    $(function () {
        ProvinceBind1();

        $("#province1").change(function () {
            CityBind1();
        })

        $("#city1").change(function () {
            CountryBind1();
        })
    })
    function ProvinceBind1() {
        // $("#province1").html("");
        var str = "";
        $.ajax({
            url: "/getProvince",
            success: function (data) {
                $.each(data.data, function (i,item) {
                    str += "<option value=" + item.cityName + ">" + item.cityName + "</option>";
                })
                $("#province1").append(str);
            },
            error: function () {
                alert("Error省");
            }
        })
    }

    function CityBind1() {
        $("#city1").html("");
        var options = $("#province1 option:selected");
        var province = options.val();//province为选中省份的cityName
        // alert(province);
        if (province == "")
            return ;
        $("#city1").html("");
        var str="<option> 出发市 </option>";

        $.ajax({
            url: "/getCities",
            data: {"parentCity": province},
            success: function (data) {
                $.each(data.data, function (i, item) {
                    str += "<option value=" + item.cityName + ">" + item.cityName + "</option>";
                });
                $("#city1").append(str);
            },
            error: function () {
                alert("Error市");
            }
        });
    }

    function CountryBind1() {
        $("#country1").html("");
        var options = $("#city1 option:selected");
        var city = options.val();
        if (city == "")
            return;
        $("#country1").html();
        var str="<option> 出发区 </option>";

        $.ajax({
            url: "/getCountries",
            data: {"parentCity": city},
            success: function (data) {
                $.each(data.data, function (i, item) {
                    str += "<option value=" + item.cityName + ">" + item.cityName + "</option>";
                });
                $("#country1").append(str);
            }
        });
    }

    //到达地2
    $(function () {
        ProvinceBind2();

        $("#province2").change(function () {
            CityBind2();
        })

        $("#city2").change(function () {
            CountryBind2();
        })
    })
    function ProvinceBind2() {
        // $("#province1").html("");
        var str = "";
        $.ajax({
            url: "/getProvince",
            success: function (data) {
                $.each(data.data, function (i,item) {
                    str += "<option value=" + item.cityName + ">" + item.cityName + "</option>";
                })
                $("#province2").append(str);
            },
            error: function () {
                alert("Error省");
            }
        })
    }

    function CityBind2() {
        $("#city2").html("");
        var options = $("#province2 option:selected");
        var province = options.val();//province为选中省份的cityName
        // alert(province);
        if (province == "")
            return ;
        $("#city2").html("");
        var str="<option> 到达市 </option>";

        $.ajax({
            url: "/getCities",
            data: {"parentCity": province},
            success: function (data) {
                $.each(data.data, function (i, item) {
                    str += "<option value=" + item.cityName + ">" + item.cityName + "</option>";
                });
                $("#city2").append(str);
            },
            error: function () {
                alert("Error市");
            }
        });
    }

    function CountryBind2() {
        $("#country2").html("");
        var options = $("#city2 option:selected");
        var city = options.val();
        if (city == "")
            return;
        $("#country2").html();
        var str="<option> 到达县 </option>";

        $.ajax({
            url: "/getCountries",
            data: {"parentCity": city},
            success: function (data) {
                $.each(data.data, function (i, item) {
                    str += "<option value=" + item.cityName + ">" + item.cityName + "</option>";
                });
                $("#country2").append(str);
            }
        });
    }

    //出发地3
    $(function () {
        ProvinceBind3();

        $("#province3").change(function () {
            CityBind3();
        })

        $("#city3").change(function () {
            CountryBind3();
        })
    })
    function ProvinceBind3() {
        // $("#province1").html("");
        var str = "";
        $.ajax({
            url: "/getProvince",
            success: function (data) {
                $.each(data.data, function (i,item) {
                    str += "<option value=" + item.cityName + ">" + item.cityName + "</option>";
                })
                $("#province3").append(str);
            },
            error: function () {
                alert("Error省");
            }
        })
    }

    function CityBind3() {
        $("#city3").html("");
        var options = $("#province3 option:selected");
        var province = options.val();//province为选中省份的cityName
        // alert(province);
        if (province == "")
            return ;
        $("#city3").html("");
        var str="<option> 出发市 </option>";

        $.ajax({
            url: "/getCities",
            data: {"parentCity": province},
            success: function (data) {
                $.each(data.data, function (i, item) {
                    str += "<option value=" + item.cityName + ">" + item.cityName + "</option>";
                });
                $("#city3").append(str);
            },
            error: function () {
                alert("Error市");
            }
        });
    }

    function CountryBind3() {
        $("#country3").html("");
        var options = $("#city3 option:selected");
        var city = options.val();
        if (city == "")
            return;
        $("#country3").html();
        var str="<option> 出发区 </option>";

        $.ajax({
            url: "/getCountries",
            data: {"parentCity": city},
            success: function (data) {
                $.each(data.data, function (i, item) {
                    str += "<option value=" + item.cityName + ">" + item.cityName + "</option>";
                });
                $("#country3").append(str);
            }
        });
    }

    //到达地4
    $(function () {
        ProvinceBind4();

        $("#province4").change(function () {
            CityBind4();
        })

        $("#city4").change(function () {
            CountryBind4();
        })
    })
    function ProvinceBind4() {
        // $("#province1").html("");
        var str = "";
        $.ajax({
            url: "/getProvince",
            success: function (data) {
                $.each(data.data, function (i,item) {
                    str += "<option value=" + item.cityName + ">" + item.cityName + "</option>";
                })
                $("#province4").append(str);
            },
            error: function () {
                alert("Error省");
            }
        })
    }

    function CityBind4() {
        $("#city4").html("");
        var options = $("#province4 option:selected");
        var province = options.val();//province为选中省份的cityName
        // alert(province);
        if (province == "")
            return ;
        $("#city4").html("");
        var str="<option> 到达市 </option>";

        $.ajax({
            url: "/getCities",
            data: {"parentCity": province},
            success: function (data) {
                $.each(data.data, function (i, item) {
                    str += "<option value=" + item.cityName + ">" + item.cityName + "</option>";
                });
                $("#city4").append(str);
            },
            error: function () {
                alert("Error市");
            }
        });
    }

    function CountryBind4() {
        $("#country4").html("");
        var options = $("#city4 option:selected");
        var city = options.val();
        if (city == "")
            return;
        $("#country4").html();
        var str="<option> 到达县 </option>";

        $.ajax({
            url: "/getCountries",
            data: {"parentCity": city},
            success: function (data) {
                $.each(data.data, function (i, item) {
                    str += "<option value=" + item.cityName + ">" + item.cityName + "</option>";
                });
                $("#country4").append(str);
            }
        });
    }

</script>

</body>
</html>